<?php include "../../coresection/connection.php";?>
<?php include "../../coresection/checkSession.php";?>
<?php include "../../coresection/order-list.php";?>
<?php include "../../coresection/get_dishes_list.php";?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <?php include '../../modules/head.php'; ?>
</head>

<body>
<?php include '../../modules/topbar.php'; ?>

<div class="setup_area">
    <?include '../../modules/sidebar-admin.php'?>

    <div class="header">
        <h1>菜式添加</h1>
        <?php include '../../modules/header.php'; ?>
    </div>


    <div class="content_area" style=" padding-bottom:350px; ">

<div class="admin_left_area">
<?include '../../model/slidebar.php'?>
</div>



        <style>
            .mulity-add-product { padding: 0; margin:15px 0 0 0px; list-style: none;overflow: hidden; padding-top: 5px;}
            .mulity-add-product li{ float: left; padding:15px; border:solid 1px #cccccc; margin-right: -1px; margin-top: -1px; height: 20px; }
        </style>



        <div class="tips" style="text-align: left">
            <div>1.请先选择时段</div>
            <div>2.先双击菜式名编辑框，再选择菜式，或者输入菜式名即可自动填充菜式资料</div>
            <div>3.可以在新价钱项修改价钱，若不修改则留空</div>
            <div>4.菜式设置完毕，多出的栏目留空即可</div>

            <input type="hidden" name="nownumber" id="nownumber" value=""/>
        </div>

<div class="main">
    <div>
        <label ><b>日期：</b></label>
        <select name="product_month" class="product_week" form="foodform" >

            <option value="<? echo number_format(date(m)) ?>"> <? echo number_format(date(m)) ?>月</option>

            <? for($i=1;$i<=12;$i++){?>
                <option value="<? echo $i ?>"> <? echo $i ?>月</option>
            <? } ?>

        </select>
        <select name="product_day" form="foodform">
            <? for($i=1;$i<=31;$i++){?>
                <option value="<? echo $i ?>"><? echo $i ?>号</option>
            <? } ?>
        </select>
    </div>

        <form action="../../coresection/admin-productadd-mulity-function2.php" method="post" enctype="multipart/form-data" id="foodform">


            <div class="formheight" style="height:107px;overflow: hidden;min-width: 1150px">
                <table class="layui-table">
                    <colgroup>
                        <col width="60px">
                        <col width="180px">
                        <col width="">
                        <col width="">
                        <col width="180px">
                    </colgroup>
                    <thead>
                    <tr>
                        <th>编号</th>

                        <th>时段</th>
                        <th>菜式 (双击或输入菜式名第一个字可选择菜式)</th>
                        <th>新价格 (非新增菜式，不用输入新价格)</th>
                        <th>发布状态</th>

                    </tr>
                    </thead>
                    <tbody>




<?php for($abc = 0;$abc < 30; $abc++){?>

    <style>
        .layui-tab-title{
            font-size: 14px;
        }
        .optionfood<? echo $abc; ?>{
            display:none;
        }

    </style>

<tr>
<td><?echo $abc+"1";?></td>






                        <td>
                            <label for="zc">早餐</label><input type="radio" name="product_at_<? echo $abc; ?>" id="timepart" value="1<? echo $abc; ?>" checked="checked" onclick="food<? echo $abc; ?>(this.value)"/>
                            <label for="wc">午餐</label><input type="radio" name="product_at_<? echo $abc; ?>" id="timepart" value="2<? echo $abc; ?>" onclick="food<? echo $abc; ?>(this.value)"/>
                            <label for="wanc">晚餐</label><input type="radio" name="product_at_<? echo $abc; ?>" id="timepart" value="3<? echo $abc; ?>" onclick="food<? echo $abc; ?>(this.value)"/>
                        </td>



                        <td>

<div class="optionfood<? echo $abc; ?> zaocanfood<? echo $abc; ?>" style="display: block;">
<? include "dishes_option_zaocan.php" ?>
                                </div>
                                <div class="optionfood<? echo $abc; ?> wucanfood<? echo $abc; ?>">
                                    <? include "dishes_option_wucan.php" ?>
                                </div>
                                <div class="optionfood<? echo $abc; ?> wancanfood<? echo $abc; ?>">
                                    <? include "dishes_option_wancan.php" ?>
                                </div>

                        </td>




                   <td ><input type="text" name="new_price_<? echo $abc; ?>" id="date"  class="layui-input"  value=""  >

                   </td>



                        <td>
                            <label for="fb">发布</label><input type="radio" name="status<? echo $abc; ?>" id="fb"value="发布"  checked="checked"/>
                            <label for="dsh">待审核</label><input type="radio" name="status<? echo $abc; ?>" id="dsh"value="待审核" />
                        </td>


    <script type="text/JavaScript">

        function food<? echo $abc; ?>(num){
            switch(num){
                case "1<? echo $abc; ?>":
                    $(".optionfood<? echo $abc; ?>").css("display","none");
                    $(".zaocanfood<? echo $abc; ?>").css("display","block");
                    break;
                case "2<? echo $abc; ?>":
                    $(".optionfood<? echo $abc; ?>").css("display","none");
                    $(".wucanfood<? echo $abc; ?>").css("display","block");
                    break;
                case "3<? echo $abc; ?>":
                    $(".optionfood<? echo $abc; ?>").css("display","none");
                    $(".wancanfood<? echo $abc; ?>").css("display","block");
                    break;
                default :
                    break;
            }


        }


    </script>

</tr>


<?}?>





                    </tbody>
                </table>
</div>







            <div style="margin-top:20px; ">
                <a href="javascript:void(0)" class="layui-btn" id="formheight" >增加</a>
                <input type="submit" class="layui-btn" value="确定菜单""/>
            </div>




            <script >



                $('#formheight').click(function(){
                    var realheight = $(".formheight").css("height");
                    realheight = parseInt(realheight) +  57;
                    $(".formheight").css("height",realheight);
                })

            </script>






                <script>
                    $("#selecttype").on("change",function(){
                        var text = $(this).find("option:selected").text();
                        $("#vccorptype").val(text)
                    })
                    $("#vccorptype").on("change",function(){
                        console.log(2)
                    })





        </form>

    <script type="text/javascript">

        function setnownumber(number){
            document.getElementById("nownumber").value=number;
        }


        function setvalue(name,price){
            var nowii=document.getElementById("nownumber").value;
            if(!nowii){
                alert("请先选择要编辑的项目");
            }
            document.getElementById("product_name_"+nowii).value=name;
            document.getElementById("product_price_"+nowii).value=price;
        }
    </script>




</div>
</div>






    <?php include '../../modules/footer.php'; ?>
</body>
</html>


<script>
    function emptyfood(emp){
        emp.value = "";
    }
</script>